PACKAGE=skype-i18n
VERSION := $(shell rpm -q --qf '%{version}\n' --specfile $(PACKAGE).spec | head -1)
RELEASE := $(shell rpm -q --qf '%{release}\n' --specfile $(PACKAGE).spec | head -1)
ARCHIVEVER := $(VERSION)-$(shell date +%Y%m%d)

BINDIR      := /usr/bin/
RPM=$(HOME)/rpm

PRODUCT      = "PCLinuxOS 2007"
export PRODUCT



clean:
	rm -f *.tar.bz2

cleandist: clean

distdir:
	if [ ! -d $(PACKAGE)-$(VERSION) ]; then mkdir $(PACKAGE)-$(VERSION); fi

localcopy: clean distdir
	tar cp --exclude=.svn --exclude=$(PACKAGE)-$(VERSION) --exclude=*.tar.bz2  . | tar xp -C $(PACKAGE)-$(VERSION)
	
tar: localcopy cleandist
	tar cjvf $(PACKAGE)-$(ARCHIVEVER).tar.bz2 $(PACKAGE)-$(VERSION)
	rm -rf $(PACKAGE)-$(VERSION)

rpm: tar
	rpmbuild -ta $(PACKAGE)-$(ARCHIVEVER).tar.bz2

rpm-install: rpm
	rpm -Uvh --force /usr/src/rpm/RPMS/noarch/$(PACKAGE)-$(VERSION)-$(RELEASE).noarch.rpm

gupload:
	gupload /usr/src/rpm/RPMS/noarch/$(PACKAGE)-$(VERSION)-$(RELEASE).noarch.rpm "Utility to make PCLinuxOS installation speaking czech"

upload:
	scp /usr/src/rpm/RPMS/noarch/$(PACKAGE)-$(VERSION)-$(RELEASE).noarch.rpm dsmid@oko.clever.cz:www/pclinuxos/2007/RPMS.czech
	scp /usr/src/rpm/SRPMS/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm dsmid@oko.clever.cz:www/pclinuxos/2007/SRPMS.czech
	ssh dsmid@oko.clever.cz www/pclinuxos/2007/regenerate
